import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '职位名称',
    align: "center",
    dataIndex: 'professionName'
  },
  {
    title: '职位编号',
    align: "center",
    dataIndex: 'professionCode'
  },
  {
    title: '所属部门id',
    align: "center",
    dataIndex: 'departmemtId_dictText'
  },
  {
    title: '所属部门名称',
    align: "center",
    dataIndex: 'departmemtName_dictText'
  },
  {
    title: '职位其它信息',
    align: "center",
    dataIndex: 'description'
  },
  {
    title: '创建时间',
    align: "center",
    dataIndex: 'createTime'
  },
  {
    title: '修改时间',
    align: "center",
    dataIndex: 'updateTime'
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '职位名称',
    field: 'professionName',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入职位名称!'},
             ];
    },
  },
  {
    label: '职位编号',
    field: 'professionCode',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入职位编号!'},
             ];
    },
  },
  {
    label: '所属部门id',
    field: 'departmemtId',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "departmemt_id"
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入所属部门id!'},
             ];
    },
  },
  {
    label: '所属部门名称',
    field: 'departmemtName',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: ""
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入所属部门名称!'},
             ];
    },
  },
  {
    label: '职位其它信息',
    field: 'description',
    component: 'Input',
  },
  {
    label: '创建时间',
    field: 'createTime',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入创建时间!'},
             ];
    },
  },
  {
    label: '修改时间',
    field: 'updateTime',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入修改时间!'},
             ];
    },
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];
